def main():
    n, m = map(int, input().split())
    grid = set()
    for _ in range(m):
        u, v, w = map(int, input().split())
        grid.add((u, v, w))
    src, dst, k = map(int, input().split())
    minist = [float('inf')] * (n + 1)
    minist[src] = 0
    for _ in range(k + 1):
        for u, v, w in grid:
            minist[v] = min(minist[v], minist[u] + w)
    # 再进行一次可以判断出有无负环
    for u, v, w in grid:
        if minist[u] + w < minist[v]:
            return "circle"
    if minist[dst] == float('inf'): return "unconnected"
    return minist[dst]


if __name__ == '__main__':
    print(main())
